{template 'admin_header'}
{if $operation == 'display'}
<form method="post" action="" id="listform">
	<div class="admin">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="add.html"> 添加内容</a> </li>
        <li>搜索：</li>
        
       
        <li>
          <input type="text" placeholder="请输入学号或者姓名" name="search" id="search" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a style="cursor: pointer;" class="button border-main icon-search" onclick="admin_search()" > 搜索</a></li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="10%">类别</th>
        <th>备注</th>
        <th>缩略图</th>
        <th>姓名</th>
        <th>学号</th>
        <th>学院</th>
        <th>班级</th>
        <th width="10%">更新时间</th>
        <th>审核状态</th>
        <th width="310" > <div style=" margin:  0 auto; width: 30px;">操作</div></th>
      </tr>
     
     	{loop $list $v}
        <tr>
		  <td>{$v['id']}</td>
		  <td>{$v['category']}</td>
          <td>{$v['remarks']}</td>
          <td width="10%"><img src="../attachment/{$v['url']}" alt="" width="70" height="50" /></td>
          <td>{$v['f_name']}</td>
          <td>{$v['f_studentid']}</td>
          <td>{$v['f_collegename']}</td>
          <td>{$v['f_classname']}</td>
          <td>{$v['date']}</td>
          <td>{$v['status']}</td>
          <td style="width: 40vh;"><div class="button-group"> <a class="button border-main" style="cursor: pointer;" href="{php echo $this->createMobileUrl('admin', array('op' => 'admin_change','x_id' => $v['id']))}" >
              <span class="icon-edit"></span> 修改</a> <a class="button border-red"  style="cursor: pointer;" onclick="admin_del({$v['id']})"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
        {/loop}
   		
      <tr>
        <td colspan="11"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>
      </tr>
    </table>
  </div>
</div>
</form>








{elseif $operation == 'admin_change'}
<div class="admin">
<div class="panel admin-panel margin-top" id="add">
        <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容</strong></div>
        <div class="body-content">
          <form method="post" class="form-x" action="" id="myform">    
            <div class="form-group">
              <div class="label">
                <label>类别：</label>
              </div>
              <div class="field">
                <input type="text" class="input w50" value="{$c_result['category']}" name="category" data-validate="required:请输入修改内容">
                <div class="tips" title=""></div>
              </div>
            </div>

         
            <div class="form-group">
              <div class="label">
                <label>备注：</label>
              </div>
              <div class="field">
                <textarea type="text" class="input" name="remarks" style="height:120px;" value="">{$c_result['remarks']}</textarea>
                <div class="tips" title=""></div>
              </div>
            </div>

            <div class="form-group">
                    <div class="label">
                      <label>姓名：</label>
                    </div>
                    <div class="field">
                      <input type="text" class="input w50" value="{$c_result['f_name']}" name="f_name" data-validate="required:请输入标题">
                      <div class="tips" title=""></div>
                    </div>
                  </div>

            <div class="form-group">
                        <div class="label">
                          <label>学号：</label>
                        </div>
                        <div class="field">
                          <input type="text" class="input w50" value="{$c_result['f_studentid']}" name="f_studentid" data-validate="required:请输入标题">
                          <div class="tips" title=""></div>
                        </div>
                      </div>
                
            <div class="form-group">
                            <div class="label">
                              <label>学院：</label>
                            </div>
                            <div class="field">
                              <input type="text" class="input w50" value="{$c_result['f_collegename']}" name="f_collegename" data-validate="required:请输入标题">
                              <div class="tips" title=""></div>
                            </div>
                          </div>

            <div class="form-group">
                    <div class="label">
                        <label>班级：</label>
                          </div>
                            <div class="field">
                              <input type="text" class="input w50" value="{$c_result['f_classname']}" name="f_classname" data-validate="required:请输入标题">
                            <div class="tips" title=""></div>
                        </div>
                </div>

                <div class="form-group">
                  <div class="label">
                    <label>审核时间：</label>
                  </div>
                  <div class="field">
                    <input type="text" class="input w50" value="{$c_result['date']}" name="date" data-validate="required:请输入标题">
                    <div class="tips" title=""></div>
                  </div>
                </div>

                <div class="form-group">
                  <div class="label">
                    <label>审核状态：</label>
                  </div>
                  <div class="field">
                    <input type="text" class="input w50" value="{$c_result['status']}" name="status" data-validate="required:请输入标题">
                    <div class="tips" title=""></div>
                  </div>
                </div>
            
                <!-- 下拉框 -->
                <!-- <div class="form-group">
                  <div class="label">
                    <label>上级分类：</label>
                  </div>
                  <div class="field">
                    <select name="pid" class="input w50">
                      <option value="">请选择分类</option>
                      <option value="">产品分类</option>
                      <option value="">产品分类</option>
                      <option value="">产品分类</option>
                      <option value="">产品分类</option>
                    </select>
                    <div class="tips" title="">不选择上级分类默认为一级分类</div>
                  </div>
                </div> -->

            <!-- 上传图片 -->
            <!-- <div class="form-group">
              <div class="label">
                <label>图片：</label>
              </div>
              <div class="field">
                <input type="text" id="url1" name="img" class="input tips" style="width:25%; float:left;" value="" data-toggle="hover" data-place="right" data-image="" title="">
                <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传" style="float:left;">
                <div class="tipss">图片尺寸：1920*500</div>
              </div>
            </div> -->


           
            <div class="form-group">
              <div class="label">
                <label></label>
              </div>
              <div class="field">

                <button class="button bg-main icon-check-square-o" type="button" onclick="admin_change()"> 提交</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>

    


    {/if}

</body>

<script type="text/javascript">

  //后台首页  删除功能
  function admin_del(id){  
    $.post("{php echo $this->createMobileUrl('admin_del')}",{id:id},function(returndata){
               if(returndata.status== '1')
               {
                 alert(JSON.parse(returndata).message);
                 window.location.href="{php echo $this->createMobileUrl('admin',array('op' => 'display'))}";
                  
               }
               else {
                 alert(JSON.parse(returndata).message);
                 window.location.href="{php echo $this->createMobileUrl('admin',array('op' => 'display'))}";
               }
               
           });
}


function admin_change(){
var formData = new FormData($("#myform")[0]);//获取表单数据  
     $.ajax({
     url: "{php echo $this->createMobileUrl('admin_change')}",//提交地址 
     type: 'POST',
     data: formData,
     async: false,
     cache: false,
     contentType: false,
     processData: false,
     success: function (returndata) {
         if(returndata.status=='1'){
             console.log(returndata);
               alert(JSON.parse(returndata).message);
             }
         else{ 
           console.log(returndata);
             alert(JSON.parse(returndata).message);
             }
     },
      error: function (returndata) {
             alert('系统错误');
             }
         });

}




//后台首页搜索功能
function admin_search(){	
    var search = document.getElementById("search").value;  
   
    $.post("{php echo $this->createMobileUrl('admin_search')}",{search:search},function(returndata){
               if(returndata.status== '1')
               {
                 console.log(1111);
                 alert(JSON.parse(returndata).message);
                //  window.location.href="{php echo $this->createMobileUrl('admin',array('op' => 'display'))}";

                  
               }
               else {
                 alert(JSON.parse(returndata).message);
                //  window.location.href="{php echo $this->createMobileUrl('admin',array('op' => 'display'))}";
               }
               
           });
}





//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


</script>


</html>


